package br.biofoco.p2p.rpc;

import com.google.inject.Singleton;

import br.biofoco.p2p.rpc.tcp.TcpEndPoint;

@Singleton
public class EndpointFactory {

	public EndPoint createEndpoint(Protocol protocol, String address, Integer port) {
		switch (protocol) {
		case TCP: return new TcpEndPoint(address, port);
		case REST: return new RestEndPoint(address, port);
		case HTTP: return new HttpEndPoint(address, port);
		default: throw new IllegalArgumentException("Invalid protocol: " + protocol);
		}
	}

}
